<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* 父容器 display: flex; */
        .father {
            width: 300px;
            height: 300px;
            border: 1px solid #000;
            display: flex;
        }

        /* 子容器 margin: auto; */
        .son {
            width: 50px;
            height: 50px;
            background-color: red;
            margin: auto;
        }
    </style>
</head>

<body>
    <div class="father">
        <div class="son">
        </div>
    </div>
</body>

</html>